home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Information / CSMP Digest / volume 3 / csmp-digest-v3-097 < prev    next >
Internet Message Format  |  1995-12-31  |  31KB

  1. From: pottier@clipper.ens.fr (Francois Pottier)
  2. Subject: csmp-digest-v3-097
  3. Date: Mon, 8 May 1995 18:38:11 +0200 (MET DST)
  4.  
  5. C.S.M.P. Digest             Mon, 08 May 95       Volume 3 : Issue 97
  6.  
  7. Today's Topics:
  8.  
  9.         Answer to your SetDeskCPat Woes Here
  10.         Extended Disk Initialization Manages woes
  11.         How do UPP's work?
  12.         Memory Allocation Question
  13.         QuickDraw GX Fan Club Page (correct address !)
  14.         Quicktime Musical Instruments
  15.         Threads and Stacks
  16.  
  17. The Comp.Sys.Mac.Programmer Digest is moderated by Francois Pottier
  18. (pottier@clipper.ens.fr).
  19.  
  20. The digest is a collection of article threads from the internet newsgroups
  21. comp.sys.mac.programmer.help, csmp.tools and csmp.misc. It is designed for
  22. people who read news semi-regularly and want an archive of the discussions.
  23. If you don't know what a newsgroup is, you probably don't have access to
  24. it. Ask your systems administrator(s) for details. If you don't have access
  25. to news, you may still be able to post messages to the group by using a
  26. mail server like anon.penet.fi (mail help@anon.penet.fi for more
  27. information).
  28.  
  29. Each issue of the digest contains one or more sets of articles (called
  30. threads), with each set corresponding to a 'discussion' of a particular
  31. subject.  The articles are not edited; all articles included in this digest
  32. are in their original posted form (as received by our news server at
  33. nef.ens.fr).  Article threads are not added to the digest until the last
  34. article added to the thread is at least two weeks old (this is to ensure that
  35. the thread is dead before adding it to the digest).  Article threads that
  36. consist of only one message are generally not included in the digest.
  37.  
  38. The digest is officially distributed by two means, by email and ftp.
  39.  
  40. If you want to receive the digest by mail, send email to listserv@ens.fr
  41. with no subject and one of the following commands as body:
  42.     help                                Sends you a summary of commands
  43.     subscribe csmp-digest Your Name     Adds you to the mailing list
  44.     signoff csmp-digest                 Removes you from the list
  45. Once you have subscribed, you will automatically receive each new
  46. issue as it is created.
  47.  
  48. The official ftp info is //ftp.dartmouth.edu/pub/csmp-digest.
  49. Questions related to the ftp site should be directed to
  50. scott.silver@dartmouth.edu.
  51.  
  52. -------------------------------------------------------
  53.  
  54. >From fizzbomb@aol.com (FizzBomb)
  55. Subject: Answer to your SetDeskCPat Woes Here
  56. Date: Sun, 23 Apr 1995 13:58:04 -0400
  57. Organization: Zyfno Zyne, Inc.
  58.  
  59. Well, I don't know if you guys got your SetDeskCPat problems straightened
  60. out, but I have the answer right here.  It comes to us from Craig
  61. Marciniak (templardev@aol.com), author of shareware sensation Before
  62. Dark.  I tried it and it works!  Enjoy!
  63.  
  64. FizzBomb <--> fizzbomb@aol.com
  65. "And here it is"
  66. - -----------
  67.  
  68. The Trap is very stable - just poorly documented!
  69.  
  70. here's what you need to do:
  71.  
  72.  SetZone(SystemZone());
  73.  
  74.  sysdeskPixPat = GetPixPat(theID);
  75.  if(sysdeskPixPat)
  76. {
  77.     DetachResource((Handle)sysdeskPixPat);
  78.     SetDeskCPat(sysdeskPixPat);
  79.  }
  80.  
  81.  SetZone(ApplicZone());
  82.  
  83. Also make sure that the right bits are set on the ppat resource (sys and
  84. purge) so other applications that count on those attribute won't puke on
  85. your patterns - AND DON'T use your own compression method on standard ppat
  86. resources - make your own type...
  87.  
  88. Craig Marciniak
  89.  
  90. ---------------------------
  91.  
  92. >From gspnx@di.unito.it (Fabrizio Oddone)
  93. Subject: Extended Disk Initialization Manages woes
  94. Date: Sat, 22 Apr 1995 12:05:35 +0200
  95. Organization: Computer Science Faculty, Torino
  96.  
  97. I got the File System Manager SDK a while ago and browsing around I found
  98. a useful chapter documenting a set of new system calls, namely:
  99. DIXFormat, DIXZero, etc.
  100.  
  101. Problem: the Universal Headers (I am at 2.0a4) don't contain the function
  102. prototypes of the Extended Disk Initialization Manager calls.
  103.  
  104. I am especially interested in calling DIXZero.
  105. I have tried lots of undocumented _Pack2 selectors, but haven't found the
  106. right one (and no, I don't want to spend days disassembling _Pack2 or
  107. trying selectors one by one ;-) ).
  108.  
  109. Can some good soul point me towards some newer headers/docs?
  110. (Please use also private e-mail, besides posting)
  111.  
  112. TIA,
  113.  
  114. -- 
  115.  Fabrizio Oddone <gspnx@di.unito.it>
  116. http://www.di.unito.it/pub/WWW/www_student/apple/FabrizioOddone/
  117.  
  118. +++++++++++++++++++++++++++
  119.  
  120. >From jumplong@aol.com (Jump Long)
  121. Date: 23 Apr 1995 12:46:41 -0400
  122. Organization: America Online, Inc. (1-800-827-6364)
  123.  
  124. >I got the File System Manager SDK a while ago and browsing around I
  125. >found a useful chapter documenting a set of new system calls, namely:
  126. >DIXFormat, DIXZero, etc.
  127. >
  128. >Problem: the Universal Headers (I am at 2.0a4) don't contain the
  129. >function prototypes of the Extended Disk Initialization Manager calls.
  130.  
  131. I know. I asked to have them added back before the FSM SDK shipped, but
  132. there didn't get added until recently.
  133.  
  134. Until then, these will work for 68K code development:
  135.  
  136. extern pascal OSErr DIXFormat(short drvNum, Boolean fmtFlag, unsigned long
  137. fmtArg, unsigned long *actSize)
  138.   THREEWORDINLINE(0x700C, 0x3F00, 0xA9E9);
  139.  
  140. extern pascal OSErr DIXZero(short drvNum, ConstStr255Param volName, short
  141. fsid, short mediaStatus, short volTypeSelector, unsigned long volSize,
  142. void *extendedInfoPtr)
  143.   THREEWORDINLINE(0x700E, 0x3F00, 0xA9E9);
  144.  
  145. extern pascal OSErr DIReformat(short drvNum, short fsid, ConstStr255Param
  146. volName, ConstStr255Param msgText)
  147.   THREEWORDINLINE(0x7010, 0x3F00, 0xA9E9);
  148.  
  149. It should be easy enough to build routine descriptors and call these from
  150. PPC code, too.
  151.  
  152. WARNING: DIXZero has a bug in current versions of the Disk Initialization
  153. Package. If you pass a non-zero value in the mediaStatus to DIXZero, it
  154. will call the Dialog Manager with a NULL DialogPtr (and that will likely
  155. crash your system). Until you see something telling you how to determine
  156. the problem has been fixed, don't call DIXZero with a non-zero mediaStatus
  157. value.
  158.  
  159. - Jim Luther
  160.  
  161. ---------------------------
  162.  
  163. >From rba26@cas.org (Brad Andrews)
  164. Subject: How do UPP's work?
  165. Date: Wed, 19 Apr 1995 12:16:29 GMT
  166. Organization: Chemical Abstracts Service
  167.  
  168. Could someone either explain to me exactly how UPP's work, or where I can find
  169. documentation on such?  Do both 68K and PPC programs work well with such, or will
  170. I have to #ifdef my code for each processor?
  171.  
  172. - -
  173.  
  174. Brad Andrews
  175. randrews@cas.org
  176. All opinions are strictly mine
  177.  
  178.  
  179.  
  180. +++++++++++++++++++++++++++
  181.  
  182. >From soori@netcom.com (Mahesh Sooriarachchi)
  183. Date: Wed, 19 Apr 1995 14:53:10 GMT
  184. Organization: Netcom Online Communications Services (408-241-9760 login: guest)
  185.  
  186. In article <1995Apr19.121629.9113@chemabs.uucp> rba26@cas.org writes:
  187.  
  188. You would create a UPP by calling NewRoutineDescriptor() or a bunch of 
  189. different flavors of it, which ultimately calls NewRoutineDescriptor().  
  190. For instance, if you want a sound completion proc for playing sound from 
  191. a file, you would call FilePlayCompletionUPP(yourProc).  This would return 
  192. you a FilePlayCompletionUPP which you can pass into SndStartFilePlay().  
  193. Once the sound has finished playing you can dispose the routine 
  194. descriptor by calling DisposeRoutineDescriptor().  You should get the New 
  195. Inside Mac book "PowerPC System Software" of something like that.
  196.  
  197.  
  198. >Could someone either explain to me exactly how UPP's work, or where I can find
  199. >documentation on such?  Do both 68K and PPC programs work well with such, or will
  200. >I have to #ifdef my code for each processor?
  201. >
  202. >---
  203. >
  204. >Brad Andrews
  205. >randrews@cas.org
  206. >All opinions are strictly mine
  207. >
  208. >
  209.  
  210.  
  211. -- 
  212.  
  213. MicroSloppy - Making it all make half ass sense.
  214.  
  215. Where do you want to go today?  None of your f$#*ing business.
  216.  
  217. Mahesh Soori.  My openions are mine, not of my employer!
  218.  
  219. +++++++++++++++++++++++++++
  220.  
  221. >From jaks@netcom.com (Eric Jackson)
  222. Date: Thu, 20 Apr 1995 02:20:15 GMT
  223. Organization: NETCOM On-line Communication Services (408 261-4700 guest)
  224.  
  225. In article <sooriD7AEoM.IB8@netcom.com>,
  226. Mahesh Sooriarachchi <soori@netcom.com> wrote:
  227. >In article <1995Apr19.121629.9113@chemabs.uucp> rba26@cas.org writes:
  228. >
  229. >You would create a UPP by calling NewRoutineDescriptor() or a bunch of 
  230. >different flavors of it, which ultimately calls NewRoutineDescriptor().  
  231. >For instance, if you want a sound completion proc for playing sound from 
  232. >a file, you would call FilePlayCompletionUPP(yourProc).  This would return 
  233. >you a FilePlayCompletionUPP which you can pass into SndStartFilePlay().  
  234. >Once the sound has finished playing you can dispose the routine 
  235. >descriptor by calling DisposeRoutineDescriptor().  You should get the New 
  236. >Inside Mac book "PowerPC System Software" of something like that.
  237. >
  238. >
  239. >>Could someone either explain to me exactly how UPP's work, or where I can find
  240. >>documentation on such?  Do both 68K and PPC programs work well with such, or will
  241. >>I have to #ifdef my code for each processor?
  242. >>
  243.  
  244. Also I don't know if you have found this out yet but you don't really need all
  245. that many UPP's in your code.  One place that you will need one is in making
  246. a native call to TrackControl, and another place is in AEInstallEventHandler,
  247. but its only in places where you are passing a pointer to a procedure to another
  248. procedure that goes into the tool box that you even need to worry about UPP
  249. troubles.
  250.  
  251. On the other hand when you are making a call from one procedure to another 
  252. inside of your own code you can do this just the same way you always did.
  253.  
  254. When you recompile your program with the universal headers you will get
  255. compiler errors because of the type changes so you just use the right functions
  256. to create your UPPs and your one your way.
  257.  
  258. Good Luck
  259.  
  260. Eric
  261.  
  262.  
  263. +++++++++++++++++++++++++++
  264.  
  265. >From Bruce@hoult.actrix.gen.nz (Bruce Hoult)
  266. Date: Fri, 21 Apr 1995 16:04:21 +1200 (NZDT)
  267. Organization: (none)
  268.  
  269. rba26@cas.org (Brad Andrews) writes:
  270. > Could someone either explain to me exactly how UPP's work, or where I can find
  271. > documentation on such?  Do both 68K and PPC programs work well with such, or will
  272. > I have to #ifdef my code for each processor?
  273.  
  274. read Inside Macintosh: PowerPC System Software.
  275.  
  276. UPP code works on both 68K and PPC because it is already #ifdef'd to do nothing
  277. on the 68K, unless you're using the 68K Code Fragment Manager (which you aren't,
  278. yet).
  279.  
  280. UPP's work by always assuming that a proc ptr points at 68K code, and if it
  281. isn't really 68K code then it will start with a special A-trap opcode that
  282. switches you into the appropriate code type -- PPC or MIPS or PA-RISC or
  283. whatever (up to 256 different processor types can be used in a "fat" program).
  284.  
  285. You could implement a "CallUPP" routine by simply switching to 68K mode and
  286. jumping to the ProcPtr, but of course it's much faster to check for the
  287. special opcode first to see whether you'd just get switched right back.
  288.  
  289. -- Bruce
  290.  
  291. ---------------------------
  292.  
  293. >From dwilliss@tnt (Dave Williss)
  294. Subject: Memory Allocation Question
  295. Date: 11 Apr 1995 14:25:51 GMT
  296. Organization: MicroImages, Inc.
  297.  
  298. I have a problem with the way the Macintosh allocates memory.  It sucks!
  299. I have no idea how much memory the program will need.  It depends
  300. entirely on what the user tries to do at runtime.  If the user wants to
  301. process a really large image, they have to bump up the "Preferred Size"
  302.  
  303. I looked into the possibility of using "Temporary Memory", but the
  304. Inside Macintosh section (2 pages) on this is rather vague.  It says
  305. you can't leave a block of temporary memory locked when calling
  306. WaitNextEvent or GetNextEvent.  Why not? Is there a simple memory
  307. allocation scheme that behaves more like malloc() under Unix?
  308.  
  309. Also, is the malloc() in MPW slow?  Is there a faster replacement?
  310. I have heard of faster malloc's that would allocate a larger chunk and
  311. manage them, but I havn't found one.
  312.  
  313. --
  314. David C. Williss                            #include <standard.disclaimer>
  315. Software Engineer -- MicroImages, Inc.          dwilliss@microimages.com
  316. WWW: http://tnt.microimages.com/~dwilliss       dwilliss@csealumni.unl.edu
  317. -- PGP Public Key available via finger from: dwilliss@csealumni.unl.edu --
  318.  
  319. +++++++++++++++++++++++++++
  320.  
  321. >From Alex Rosen <alex@procd.com>
  322. Date: 11 Apr 1995 21:38:52 GMT
  323. Organization: Pro CD, Inc.
  324.  
  325. In article <3me3hf$bfd@westie.mid.net> Dave Williss, dwilliss@tnt writes:
  326. > I looked into the possibility of using "Temporary Memory", but the
  327. > Inside Macintosh section (2 pages) on this is rather vague.  It says
  328. > you can't leave a block of temporary memory locked when calling
  329. > WaitNextEvent or GetNextEvent.  Why not? Is there a simple memory
  330. > allocation scheme that behaves more like malloc() under Unix?
  331.  
  332. There are two reasons not to leave a temporary handle locked: (1) it can
  333. fragment the entire Mac memory, preventing the user from launching
  334. programs, and (2) Apple Says It's A Bad Thing, meaning it's likely to
  335. break with future System Software. If you're just developing in-house and
  336. don't mind fragmentation problems, it's probably not horrible, but if
  337. you're releasing this I would advise against it.
  338.  
  339. > Also, is the malloc() in MPW slow?  Is there a faster replacement?
  340. > I have heard of faster malloc's that would allocate a larger chunk and
  341. > manage them, but I havn't found one.
  342.  
  343. All implementations of malloc and the C++ new operator use this technique
  344. already. They allocate 15K chunks of memory, then dole them out as
  345. needed. They do this because NewPtr (which they call to actually do the
  346. allocation) is slow.
  347.  
  348. This whole mess is an unfortunate byproduct of the simplicity of the
  349. MacOS. Learn to live with it, and be glad it's not DOS!
  350.  
  351. --Alex
  352.  
  353. +++++++++++++++++++++++++++
  354.  
  355. >From grobbins@znet.com (Grobbins)
  356. Date: Sat, 15 Apr 1995 12:42:11 -0700
  357. Organization: Skunkworks
  358.  
  359. In article <3mestc$j3i@sundog.tiac.net>, Alex Rosen <alex@procd.com> wrote:
  360. >In article <3me3hf$bfd@westie.mid.net> Dave Williss, dwilliss@tnt writes:
  361. >> I looked into the possibility of using "Temporary Memory", but the
  362. >> Inside Macintosh section (2 pages) on this is rather vague.  It says
  363. >> you can't leave a block of temporary memory locked when calling
  364. >> WaitNextEvent or GetNextEvent
  365. >There are two reasons not to leave a temporary handle locked: (1) it can
  366. >fragment the entire Mac memory, preventing the user from launching
  367. >programs, and (2) Apple Says It's A Bad Thing, meaning it's likely to
  368. >break with future System Software.
  369.  
  370. Temporary memory is not an evil or dangerous thing, but you should observe 
  371. a number of rules when using it.
  372.  
  373. - Use blocks from within the application partition for static needs.
  374.  
  375. Any memory usually required by the application should be accommodated within
  376. the application partition. The user should be guaranteed that if the
  377. application can be launched, it has enough memory to at least run properly.
  378. Program code, window records, dialog contents, scratch space and necessary
  379. small buffers are examples of items that should all be held in normal blocks
  380. from within the application heap.
  381.  
  382. The minimum partition size should also be able to accommodate at least one
  383. document with a moderate amount of data. This is necessary to keep the
  384. promise that if the application can be launched, it can be used.
  385.  
  386. - Use temporary memory for documents and other dynamic needs.
  387.  
  388. The primary use of temporary memory is for dynamic data. Documents are
  389. "temporary" in the sense that the space they occupy is not always needed
  390. when the program is running.
  391.  
  392. Temporary memory is also useful for large buffers, such as might be used for
  393. copying files. Remember to provide adequate minimal space within the
  394. application partition so that these functions can be carried out even when
  395. no temporary memory is available.
  396.  
  397. - Be prepared to reallocate handles.
  398.  
  399. Sometimes adequate space will be available in the application heap when it
  400. is not available in temporary memory. Sometimes the opposite will be true.
  401. If an attempt to grow a handle with SetHandleSize fails, try reallocating
  402. the block so the user will be able to take advantage of any available
  403. memory.
  404.  
  405. - Never require temporary memory.
  406.  
  407. Prior to the introduction of MultiFinder, applications were restricted to
  408. the memory available in their own heap zone. This wasn't a problem because
  409. the application heap occupied most of the Mac's memory.
  410.  
  411. Down the road, temporary memory may become unavailable or unnecessary under
  412. future system software. For example, if each application were to be
  413. allocated its own unique address space, then it would again offer no
  414. advantage for applications to request space from outside of their partition.
  415.  
  416. Applications should never require the presence of temporary memory. When
  417. Gestalt indicates that temporary memory is not available, an application
  418. should continue to make the best use of the memory available to it.
  419.  
  420. - Unlock temporary memory handles across calls to WaitNextEvent.
  421.  
  422. Temporary memory occupies space which might be needed by the System or by
  423. other applications. Good citizenship demands that temporary memory handles
  424. be unlocked whenever an application calls WaitNextEvent to avoid
  425. unnecessarily restricting the memory available to other applications.
  426.  
  427. - Reduce or dispose of temporary memory handles whenever possible.
  428.  
  429. A key element to giving users natural control of memory usage is that, when
  430. documents are closed, more memory should become available to all
  431. applications. This requires that applications not hold on to temporary
  432. memory handles which are not currently needed. When the data in a handle is
  433. no longer absolutely necessary, the application should immediately dispose
  434. of or empty the handle.
  435.  
  436. Similarly, users will expect that closing a document should free up memory
  437. for other applications. When a user closes a document which is being kept in
  438. the application's heap, and that frees up enough space to move data from
  439. temporary memory into the application heap, the application should do so.
  440. This gives the user the benefit of the additional free space for other
  441. applications.
  442.  
  443. - Remember that temp memory handles come from a different heap.
  444.  
  445. Some rare toolbox calls or code libraries may check which heap a handle is
  446. in and operate in an unexpected manner if the handle is from a heap other
  447. than the application heap. Unfortunately, there is no list of System calls
  448. which expect handles to be in the application heap. Under System 7, the
  449. Memory Manager is fully compatible with temp memory handles. Beware when
  450. passing a temp memory handle to any code which might make inappropriate
  451. assumptions about the handle.
  452.  
  453. - Do not allocate a large number of temporary handles.
  454.  
  455. The Memory Manager uses relatively simple algorithms to manage heaps.
  456. Allocating too many handles in one heap can have a noticeable, adverse
  457. affect on performance.
  458.  
  459. Because the heap from which temporary handlers are allocated is shared,
  460. applications should allocate only a reasonably small number of temporary
  461. handles. One temporary handle for each open document, up to several dozen,
  462. is not excessive, but a hundred or more temporary handles probably is too
  463. many. When a large number of handles is necessary, create a new heap in
  464. either a non-relocatable block in the main application partition or in a 
  465. locked temporary block.
  466.  
  467.  
  468. Grobbins                              grobbins@znet.com
  469.  
  470.  
  471. ---------------------------
  472.  
  473. >From kenneth.trueman@residences.ulaval.ca (Kenneth Trueman)
  474. Subject: QuickDraw GX Fan Club Page (correct address !)
  475. Date: Mon, 24 Apr 1995 05:13:11 GMT
  476. Organization: Laval University
  477.  
  478. Hi everybody !
  479.  
  480. I recently setup the QuickDraw GX Fan Club Page on the WWW. It's a page
  481. devoted to all things GX (the technology, compatible applications,
  482. utilities, drivers, etc.)
  483.  
  484. Since everybody here is a programmer (?  :-), I figure most of you know
  485. about GX, etc. The problem is that Apple doesn't promote GX much to The
  486. Rest Of Us. My page tries to fill that void. ;-)
  487.  
  488. If you have any info about GX that you'd like to share, if you have a GX
  489. based product you want to let people know about, etc, let me know. I'd be
  490. very happy to put it on my page, or provide a URL to it elsewhere ... If
  491. you see info on my page that is incorrect let me know, and I'll change it
  492. ...
  493.  
  494. We've already converted one guy to GX (I've got the e-mail to prove it),
  495. and we can convert more, if enough people know about it.  So come on by
  496. and let me know what you think.  :-) I really want to make this the best
  497. page possible !
  498.  
  499. Here's the URL for the QuickDraw GX Fan Club page ...
  500. <http://aah.residences.ulaval.ca/quickgx/quickgx.html>
  501.  
  502. This a totally non-profit, independant thing by a guy who digs GX !  :-)
  503.  
  504. Thanks  :-)
  505. Kenneth
  506.  
  507. -- 
  508. Kenneth Trueman                  kenneth.trueman@residences.ulaval.ca
  509. Laval University                 ktrueman@eworld.com 
  510. Quebec City, Canada              KTrueman@cmq.qc.ca
  511.  
  512. QuickDraw GX Fan Club: <http://132.203.80.10/quickgx/quickgx.html>
  513. The Trueman Files : <http://132.203.80.10/>easy 
  514. Have a nice day !  ?8-)
  515.  
  516.  
  517. ---------------------------
  518.  
  519. >From suhieber@cln.etc.bc.ca (Susan Hiebert)
  520. Subject: Quicktime Musical Instruments
  521. Date: Mon, 17 Apr 1995 03:45:20 GMT
  522. Organization: Education Technology Centre of B.C.
  523.  
  524.  
  525. Hi. My program uses QuickTime 2.0 & QT Musical Instruments to play
  526. MIDI files. I have never used the Gestalt Manager before. How do I
  527. use it to determine if QT 2.0 & QT Musical Instruments are installed?
  528.  
  529. +++++++++++++++++++++++++++
  530.  
  531. >From mhl@icf.hrb.com (mark)
  532. Date: 17 Apr 95 13:12:36 EST
  533. Organization: HRB Systems, Inc.
  534.  
  535. In article <1995Apr17.034520.28107@news.etc.bc.ca>, suhieber@cln.etc.bc.ca (Susan Hiebert) writes:
  536. > Hi. My program uses QuickTime 2.0 & QT Musical Instruments to play
  537. > MIDI files. I have never used the Gestalt Manager before. How do I
  538. > use it to determine if QT 2.0 & QT Musical Instruments are installed?
  539.  
  540. Better yet, how do we get a chance to look at you code? I have been
  541. trying to figure out how to use QTMI && MIDI for a while.
  542.  
  543. -- 
  544. Hope this helps.
  545.  
  546. Mark H. Linton
  547. ____________________________________________________________________
  548. mark \'mdrk\ n [ME, fr. OE mearc boundary, march, sign; akin to OHG
  549. marha boundary, L margo] 1 a : a conspicuous object serving as a guide
  550. for travelers 2 : A standard or criterion of quality 3 : An object or
  551. point that serves as a guide --idiom. mark time. 1 : To make little or
  552. no progress
  553.  
  554. +++++++++++++++++++++++++++
  555.  
  556. >From sandvik@apple.com (Kent Sandvik)
  557. Date: Mon, 17 Apr 1995 23:37:03 -0800
  558. Organization: Apple Computer, Inc. Developer Technical Support
  559.  
  560. In article <1995Apr17.034520.28107@news.etc.bc.ca>, suhieber@cln.etc.bc.ca
  561. (Susan Hiebert) wrote:
  562.  
  563. > Hi. My program uses QuickTime 2.0 & QT Musical Instruments to play
  564. > MIDI files. I have never used the Gestalt Manager before. How do I
  565. > use it to determine if QT 2.0 & QT Musical Instruments are installed?
  566.  
  567. [could someone FAQ this, thx?]
  568.  
  569. Get the DTSQTUtilities kit from the following URL:
  570. ftp://ftp.info.apple.com/dts/quicktime/dtsqtutils.Apr95.hqx
  571.  
  572. The documentation, QuickTime 2.0 Developer Guide for Macintosh:
  573. ftp://ftp.info.apple.com/dts/quicktime/QT_MAC.PDF.hqx (Acrobat format).
  574.  
  575. Sneak preview of the DTSQTUtilities kit (test for QT, test for the
  576. PowerPlug file, test is musical instruments are available). Cheers,
  577. Kent/DTS:
  578. - ---
  579.  
  580.  
  581. /*______________________________________________________________________
  582.    QTUIsQuickTimeInstalled - Test if QuickTime is installed.
  583.  
  584. pascal Boolean    QTUIsQuickTimeInstalled(void) 
  585.  
  586. DESCRIPTION
  587.    InitQuickTime will test if QuickTime is present. We are not interested
  588. in the QuickTime
  589.    version.
  590. */
  591.  
  592. pascal Boolean QTUIsQuickTimeInstalled(void) 
  593. {
  594.    long     qtVersion;
  595.    OSErr    anErr;
  596.  
  597.    anErr = Gestalt(gestaltQuickTime, &qtVersion); DebugAssert(anErr == noErr);
  598.    if (anErr != noErr)
  599.       return false;     // no QT present
  600.    else
  601.       return true;
  602. }
  603.  
  604.  
  605. /*______________________________________________________________________
  606.    QTUIsQuickTimeCFMInstalled - Test if the QuickTime CFM libraries are
  607. installed and in the 
  608.    right place.
  609.  
  610. pascal Boolean    QTUIsQuickTimeCFMInstalled(void) 
  611.  
  612. DESCRIPTION
  613.    QTUIsQuickTimeCFMInstalled will test if the CFM QuickTime libraries are
  614. present (QuickTime 
  615.    PowerPlug, for instance), and if the libraries are still present (this
  616. because the libraries are 
  617.    registered once when Gestalt finds then during runtime, and the end
  618. user might delete these, 
  619.    or move them to another location later)(.
  620. */
  621.  
  622. #ifdef powerc
  623. pascal Boolean QTUIsQuickTimeCFMInstalled(void) 
  624. {
  625.    OSErr    anErr;
  626.    long     qtFeatures; 
  627.  
  628. // Test if the library is registered.
  629.    anErr = Gestalt(gestaltQuickTimeFeatures, &qtFeatures);
  630. DebugAssert(anErr == noErr);
  631.    
  632.     if (!(  (anErr == noErr)  &&  (qtFeatures & (1 <<
  633. gestaltPPCQuickTimeLibPresent))  )) // not true
  634.           return false;
  635.           
  636. // Test if a function is available (the library is not moved from the
  637. Extension folder),  this is the 
  638. // trick to be used concerning testing if a function is available via CFM.
  639.  
  640.    if   ( ! CompressImage )
  641.       return false;     
  642.    else 
  643.       return true;
  644. }
  645. #endif powerc
  646.  
  647.  
  648. /*______________________________________________________________________
  649.    QTUGetQTVersion - Return the current QuickTime version number.
  650.  
  651. pascal long QTUGetQTVersion()
  652.  
  653. DESCRIPTION
  654.    QTUGetQTVersion is a simple function that will return the current
  655. QuickTime version number,
  656.    and if QuickTime is not installed it will return 0L.  The high order
  657. word defines the version number, 
  658.    for instance 0x0161 defines version 1.6.1.
  659.    
  660.    You could also directly assign a boolean value stating if a certain
  661. version is true by using this
  662.    kind of an expression:
  663.    
  664.    Boolean gHasQT2.0 = (( QTUGetQTVersion() >>  16) & 0xFFFF) >= 0x200;
  665.    
  666. EXAMPLE
  667.    if( (QTUGetQTVersion() >> 16) < 0x150 ) return; // need to work with QT
  668. 1.5 or higher.
  669. */
  670.  
  671. pascal long QTUGetQTVersion()
  672. {
  673.    long version;
  674.    
  675.    if(Gestalt(gestaltQuickTime, &version) == noErr)
  676.       return version;
  677.    else
  678.       return 0L;
  679. }
  680.  
  681.  
  682. /*______________________________________________________________________
  683.    QTUAreQuickTimeMusicInstrumentsPresent - Test if the Musical
  684. Instruments Extension is 
  685.    installed.
  686.  
  687. pascal Boolean QTUAreQuickTimeMusicInstrumentsPresent(void)
  688.  
  689. DESCRIPTION
  690.    QTUAreQuickTimeMusicInstrumentsPresent tests if the QuickTime Musical
  691. Instruments
  692.    extension (actually a component) is registered. If this is not the
  693. case, then most likely
  694.    the extension was never placed into the extension folder, and the end
  695. user should be
  696.    informed about this.
  697. */
  698.  
  699. pascal Boolean QTUAreQuickTimeMusicInstrumentsPresent(void)
  700. {
  701.    ComponentDescription aCD;
  702.    
  703.    aCD.componentType = 'inst';
  704.    aCD.componentSubType = 'ss  ';
  705.    aCD.componentManufacturer = 'appl';
  706.    
  707.    if(FindNextComponent((Component)0, &aCD) != NULL)
  708.       return true;
  709.    else
  710.       return false;
  711. }
  712.  
  713. -- 
  714. Kent Sandvik   sandvik@apple.com                  Working with Multimedia stuff...
  715. Apple Developer Technical Support.                                     Private activities on Internet.
  716.  
  717. +++++++++++++++++++++++++++
  718.  
  719. >From suhieber@cln.etc.bc.ca (Susan Hiebert)
  720. Date: Thu, 20 Apr 1995 02:02:24 GMT
  721. Organization: Education Technology Centre of B.C.
  722.  
  723.  
  724. > > Hi. My program uses QuickTime 2.0 & QT Musical Instruments to play 
  725. > > MIDI files. I have never used the Gestalt Manager before. How do I 
  726. > > use it to determine if QT 2.0 & QT Musical Instruments are installed? 
  727.  
  728. > Better yet, how do we get a chance to look at you code? I have been
  729. > trying to figure out how to use QTMI && MIDI for a while.
  730.  
  731. Actually that part was very easy. I converted the MIDI
  732. files with MoviePlayer, then I took the 'moov' resource 
  733. out of the file, and stored it as a resource in my program's
  734. resource fork, under a different, custom resource type.
  735. Then I also stored the data fork of the file as a different
  736. type of resource in my program.
  737.  
  738. Then, to play a movie I:
  739.  
  740. * call EnterMovies() at startup
  741.  
  742. * copy my resource to my preference file in the system folder (sneaky, eh?) 
  743.   and change the resource type back to 'moov'
  744.  
  745. * copy the other resource to the data fork of my pref file
  746.  
  747. * I have a global variable of type Movie declared (as moovy)
  748.  
  749. * I call OpenMovieFile() on my pref file, and then NewMovieFromFile(), 
  750.   then CloseMovieFile()
  751.  
  752. * to play the movie I call
  753.     GoToBeginningOfMovie(moovy);        
  754.     MoviesTask(moovy, 0);
  755.     StartMovie(moovy);
  756.     then to keep the music going during game play, every once and a 
  757.     while I call MoviesTask() again. To stop the movie, I call (what 
  758.     do you know) StopMovie(), and before I load a new movie, I call
  759.     DisposeMovie().
  760.  
  761. * Then before my program quits, I delete all the movie stuff 
  762.   from my pref file, so no one will find it.
  763.  
  764. Thus, I can play movies and protect the MIDI files written by a
  765. friend specifically for the game, from being copied around
  766.  
  767. It was quite easy. I learned everything I need to know in order 
  768. to do this in one afternoon, from the header file, and a code 
  769. example off the CodeWarrior CD.
  770.  
  771. Hope this helps. Good luck!
  772.  
  773. Btw, if any QT gurus notice anything wrong I am doing, let me know 
  774. please! It works for me though.
  775.  
  776. P.S Not my account, so E-mail should go to Regulus240@aol.com
  777.  
  778. ---------------------------
  779.  
  780. >From bentley@crenelle.com (Michael Brian Bentley)
  781. Subject: Threads and Stacks
  782. Date: Fri, 21 Apr 1995 16:14:22 -0500
  783. Organization: Crenelle Incorporated
  784.  
  785. 1) What is the default stack size for a Thread Manager (non-main) thread?
  786. 2) Does anyone have a deterministic procedure for calculating a thread's
  787. stack requirements?
  788. 3) Do any MacOS debuggers provide a tool for recording the maximum stack
  789. usage of threads during stress testing?
  790.  
  791. -Mike Bentley
  792. Crenelle Inc.
  793. -- 
  794. Michael Brian Bentley - Crenelle Incorporated - bentley@crenelle.com
  795. 1935 West Pratt Boulevard Suite One, Chicago Ill 60626-3133
  796. AOL: crenelle CIS: 75026,315 GIS: BENTLEY Alink: Crenelle
  797.  
  798. +++++++++++++++++++++++++++
  799.  
  800. >From oster@netcom.com (David Phillip Oster)
  801. Date: Sat, 22 Apr 1995 03:05:08 GMT
  802. Organization: Netcom Online Communications Services (408-241-9760 login: guest)
  803.  
  804. In article <bentley-2104951614220001@bentley.pr.mcs.net> bentley@crenelle.com (Michael Brian Bentley) writes:
  805.  
  806. >2) Does anyone have a deterministic procedure for calculating a thread's
  807. >stack requirements?
  808. allocate a 10k stack. Fill the first 9k with 0xDEADBEEF. On termination,
  809. search from the end toward the beginning looking for the first word that
  810. isn't DEADBEEF. That will give you the stack usage. Remember the
  811. sp points to the high address end of the stack!
  812. -- 
  813. - ------- <mail-to:oster@netcom.com> ----------
  814. Ahh! The thorazine is wearing off and the odinazine is coming on...
  815.  
  816. ---------------------------
  817.  
  818. End of C.S.M.P. Digest
  819. **********************
  820.